<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../js/vue-2.6.12.js"></script>
  
</head>
<body>
  <div id="app">
    <input type="text" name="name" v-model="name"/>
    <button @click="getName">获取值</button>
    <button @click="setName">设置值</button>
  </div>
  <script type="text/javascript">
    const vm = new Vue({
      el:"#app",
      data:{
        name:""
      },
      methods:{
        getName:function(){
          alert(this.name);
        },
        setName:function(){
          this.name = "xiaohei";
        }
      }
    });

  </script>
</body>
</html>